/**
 * https://codeforces.com/contest/1999/problem/A
 */

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		int sum=n%10;
		n/=10;
		sum+=n;
		cout<<sum<<endl;
	}
	return 0;
}